package com.itheima.reggie.mapper;

import com.itheima.reggie.dto.DishDto;
import com.itheima.reggie.entity.Dish;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;

public interface DishMapper {
    @Select("select count(*) from dish where category_id=#{id}")
    Integer findByCategoryId(long id);

    List<DishDto> findByPage(@Param("name") String name);

    void save(DishDto dishDto);

    void delete(@Param("ids") List<Long> ids);

    DishDto findById(long id);

    void update(DishDto dishDto);


    //根据类别Id查询菜品列表的方法
    @Select("select * from dish where category_id=#{cid} and status=#{status}")
    List<Dish> findAllByCid(Long cid, Integer status);

    void updateStatus(@Param("ids") List<Long> ids, @Param("status") Integer status);
}
